package demo14;

public class Student implements Comparable{
    private String name;
    private double height;
    private int age;

    public Student() {
    }

    public Student(String name, double height, int age) {
        this.name = name;
        this.height = height;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public int compareTo(Object o) {
        Student s = (Student) o;
        if (this.age <= s.getAge()) return -1;
        else return 1;
    }

    @Override
    public String toString() {
        return "Student{" +
        "name='" + name + '\'' +
        ", height=" + height +
        ", age=" + age +
        '}';
    }
}
